Optimal. Leaf size=92 \[ -\frac {a^2 (c-2 d) x}{d^2}+\frac {2 a^2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {a^2 \cos (e+f x)}{d f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {2825, 2814,
2739, 632, 210} \begin {gather*} \frac {2 a^2 (c-d)^2 \text {ArcTan}\left (\frac {c \tan \left (\frac {1}{2} (e+f x)\right )+d}{\sqrt {c^2-d^2}}\right )}{d^2 f \sqrt {c^2-d^2}}-\frac {a^2 x (c-2 d)}{d^2}-\frac {a^2 \cos (e+f x)}{d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2814
Rule 2825
Rubi steps
\begin {align*} \int \frac {(a+a \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx &=-\frac {a^2 \cos (e+f x)}{d f}+\frac {\int \frac {a^2 d-a^2 (c-2 d) \sin (e+f x)}{c+d \sin (e+f x)} \, dx}{d}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}+\frac {\left (a^2 (c-d)^2\right ) \int \frac {1}{c+d \sin (e+f x)} \, dx}{d^2}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}+\frac {\left (2 a^2 (c-d)^2\right ) \text {Subst}\left (\int \frac {1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}-\frac {\left (4 a^2 (c-d)^2\right ) \text {Subst}\left (\int \frac {1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f}\\ &=-\frac {a^2 (c-2 d) x}{d^2}+\frac {2 a^2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {a^2 \cos (e+f x)}{d f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.27, size = 130, normalized size = 1.41 \begin {gather*} -\frac {a^2 \left (-2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )+\sqrt {c^2-d^2} ((c-2 d) (e+f x)+d \cos (e+f x))\right ) (1+\sin (e+f x))^2}{d^2 \sqrt {c^2-d^2} f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^4} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.33, size = 105, normalized size = 1.14
method | result | size |
derivativedivides | \(\frac {2 a^{2} \left (\frac {\left (c^{2}-2 c d +d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}-\frac {\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (c -2 d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) | \(105\) |
default | \(\frac {2 a^{2} \left (\frac {\left (c^{2}-2 c d +d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}-\frac {\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (c -2 d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) | \(105\) |
risch | \(-\frac {a^{2} x c}{d^{2}}+\frac {2 a^{2} x}{d}-\frac {a^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 d f}-\frac {a^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 d f}+\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right ) c}{\left (c +d \right ) f \,d^{2}}-\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right )}{\left (c +d \right ) f d}-\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {-i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right ) c}{\left (c +d \right ) f \,d^{2}}+\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {-i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right )}{\left (c +d \right ) f d}\) | \(303\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 307, normalized size = 3.34 \begin {gather*} \left [-\frac {2 \, a^{2} d \cos \left (f x + e\right ) + 2 \, {\left (a^{2} c - 2 \, a^{2} d\right )} f x + {\left (a^{2} c - a^{2} d\right )} \sqrt {-\frac {c - d}{c + d}} \log \left (\frac {{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \, {\left ({\left (c^{2} + c d\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + {\left (c d + d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt {-\frac {c - d}{c + d}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right )}{2 \, d^{2} f}, -\frac {a^{2} d \cos \left (f x + e\right ) + {\left (a^{2} c - 2 \, a^{2} d\right )} f x + {\left (a^{2} c - a^{2} d\right )} \sqrt {\frac {c - d}{c + d}} \arctan \left (-\frac {{\left (c \sin \left (f x + e\right ) + d\right )} \sqrt {\frac {c - d}{c + d}}}{{\left (c - d\right )} \cos \left (f x + e\right )}\right )}{d^{2} f}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 3709 vs.
\(2 (76) = 152\).
time = 180.78, size = 3709, normalized size = 40.32 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 136, normalized size = 1.48 \begin {gather*} -\frac {\frac {{\left (a^{2} c - 2 \, a^{2} d\right )} {\left (f x + e\right )}}{d^{2}} + \frac {2 \, a^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )} d} - \frac {2 \, {\left (a^{2} c^{2} - 2 \, a^{2} c d + a^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} d^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.68, size = 940, normalized size = 10.22 \begin {gather*} \frac {4\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c+d\right )}-\frac {a^2\,\cos \left (e+f\,x\right )}{f\,\left (c+d\right )}+\frac {2\,a^2\,c\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,\left (c+d\right )}-\frac {2\,a^2\,c^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d^2\,f\,\left (c+d\right )}-\frac {a^2\,c\,\cos \left (e+f\,x\right )}{d\,f\,\left (c+d\right )}+\frac {a^2\,\mathrm {atan}\left (\frac {\left (3\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}-2\,c^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-2\,c^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}+7\,d^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+10\,c\,d^5\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+4\,c^5\,d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+4\,c^2\,d^4\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-3\,c^3\,d^3\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-2\,c^4\,d^2\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-9\,c^2\,d^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-12\,c^3\,d^3\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+6\,c^4\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+c\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}+4\,c\,d^5\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+c^5\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}\right )\,1{}\mathrm {i}}{d\,\left (c+d\right )\,\left (3\,c^5\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-5\,c\,d^5\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-10\,d^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+16\,c\,d^5\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+8\,c^2\,d^4\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+2\,c^3\,d^3\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-8\,c^4\,d^2\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+4\,c^2\,d^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-16\,c^3\,d^3\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+6\,c^4\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}\right )\,\sqrt {-\left (c+d\right )\,{\left (c-d\right )}^3}\,2{}\mathrm {i}}{d^2\,f\,\left (c+d\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________